<?php

namespace App\Models\Application;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class PaneltplArea
 * @package App\Models\Application
 * @version July 16, 2018, 11:24 am CST
 *
 * @property \App\Models\Application\Paneltpl paneltpl
 * @property \App\Models\Application\Meta meta
 * @property integer paneltpl_id
 * @property string area
 * @property integer meta_id
 * @property string ui
 * @property string onup
 * @property string ondown
 * @property string onleft
 * @property string onright
 * @property string options
 * @property string description
 */
class PaneltplArea extends Model
{
    use SoftDeletes;


    public $table = 'paneltpl_areas';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'paneltpl_id',
        'area',
        'meta_id',
        'ui',
        'onup',
        'ondown',
        'onleft',
        'onright',
        'options',
        'description'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'paneltpl_id' => 'integer',
        'area' => 'string',
        'meta_id' => 'integer',
        'ui' => 'string',
        'onup' => 'string',
        'ondown' => 'string',
        'onleft' => 'string',
        'onright' => 'string',
        'options' => 'string',
        'description' => 'string'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        'area' => 'required|max:100'
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function paneltpl()
    {
        return $this->hasOne(\App\Models\Application\Paneltpl::class, 'id', 'paneltpl_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function meta()
    {
        return $this->hasOne(\App\Models\Operation\Meta::class, 'id', 'meta_id');
    }

}
